<template>
    <div class="weather">
        <el-table :data="tableData" stripe style="width: 100%">
    <el-table-column prop="date" label="时间" width="150"/>
    <el-table-column prop="week" label="星期" width="150" />
    <el-table-column prop="weather" label="天气" width="150"/>
     <el-table-column prop="real" label="平均温度" width="150" />
     <el-table-column prop="lowest" label="最低温度" width="150" />

  </el-table>
    </div>
</template>
<script>
import {weather} from"../../api/dataapi.js"
import {reactive,toRefs,onMounted} from "vue"
export default {
    setup(){
        const data =reactive({
     tableData:[],
     total:0
   });
   let getData =()=>{
     weather().then(r=>{
       data.tableData =r.data.newslist.splice(0,10);
       data.total =r.data.newslist.length
     })
   };
   onMounted(()=>{
     getData()
   })
return{
 ...toRefs(data)
}
    }
}
</script>
<style scoped>
.weather{
    width: 900px;
}
</style>